<template>
  <div id="scrollBox">
    <i class="el-icon-caret-right"></i>
    <el-carousel
      class="carousel"
      height="20px"
      direction="vertical"
      :autoplay="true"
      indicator-position="none"
      :interval="3000"
    >
      <el-carousel-item v-for="item in scrollInfos" :key="item.id">
        <div class="medium" @click="toViewText">{{ item.text }}</div>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
export default {
  name: "scrollBox",
  components: {},
  data() {
    return {
      scrollInfos: [
        {
          id: 1,
          text:
            "这是弹幕1，请及时关注信息，超出部分的文字将会隐藏，以省略号方式显示"
        },
        {
          id: 2,
          text:
            "与现实生活一致：与现实生活的流程、逻辑保持一致，遵循用户习惯的语言和概念"
        },
        {
          id: 3,
          text:
            "在界面中一致：所有的元素和结构需保持一致，比如：设计样式、图标和文本、元素的位置等"
        },
        {
          id: 4,
          text:
            "帮助用户识别：界面简单直白，让用户快速识别而非回忆，减少用户记忆负担。"
        },
        {
          id: 5,
          text:
            "结果可控：用户可以自由的进行操作，包括撤销、回退和终止当前操作等。"
        }
      ]
    };
  },
  created() {},
  methods: {
    toViewText() {
      this.$router.push({
        path: "/viewBox",
        query: { data: this.scrollInfos }
      });
    }
  }
};
</script>
<style lang="scss" scoped>
#scrollBox {
  width: 400px;
  position: relative;
}
.el-carousel__item .medium {
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  // color: #475669;
  font-size: 12px;
  opacity: 0.75;
  line-height: 20px;
  margin: 0;
}

.el-icon-caret-right {
  position: absolute;
  left: -20px;
  top: 3px;
  display: inline-block;
}

.el-carousel__item:nth-child(2n) {
  // background-color: #99a9bf;
}

.el-carousel__item:nth-child(2n + 1) {
  // background-color: #d3dce6;
}
</style>